<?php
/**
 * handles the view functionality of our mvc framework
 * @author astolarski
 *
 */
class Core_Controller_View implements Core_Controller_Viewable {
	
	/**
	 * holds variables assigned to template
	 */
	private $data = array();
	/**
	 * holds render status of view
	 */
	private $render = FALSE;
	/**
	 * construtor();
	 * accept a template to load
	 * @param unknown $template
	 */
	public function __construct($template){
		/**
		 * trigger render to include file when this model is destroyed
		 * if we render it now, we wouldn't be abble to assign variables
		 * to the view!
		 */
		//$template_status = new Core_Model_Loadtemplate();
		//$template_status->main($variables);
		$this->render = $template;
	}
	
	/**
	 * @see Core_Controller_Viewable::assign()
	 */
	public function assign($variable = null, $value = null){
		$this->data[$variable] = $value;
	}
	
	/**
	 * destructor()
	 */
	public function __destruct(){
		// parse data variables into local variables, so that they render to the view
		$data = $this->data;
		// render view
                //echo $this->render;
		include $this->render;
	}
	
}